package com.example.host.utils;

import org.springframework.stereotype.Component;

import java.io.File;


/**
 * 相对路径转化为绝对路径的工具类
 */
@Component
public class AbsolutePathGetter {
    public String getAbsolutePath(String relativePath){
        File file = new File(relativePath);
        try {
            return file.getCanonicalPath().replace("\\","/");
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
